package easy;

public class a504_七进制数 {
    public String convertToBase7(int num) {
        StringBuilder sb=new StringBuilder();
        int temp=Math.abs(num);
        while (temp>=7){
            sb.append(temp%7);
            temp=temp/7;
        }sb.append(temp%7);

        return num>=0 ?sb.reverse().toString():sb.append('-').reverse().toString();

    }

    public static void main(String[] args) {
        String s="";
        System.out.println("s = " + s.substring(0));
    }
}